home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 February: Tool Chest / Dev.CD Feb 95 / Dev.CD Feb 95.toast / Tool Chest / Interfaces / Universal Interfaces 2.0a3 / Universal AIncludes / Components.a < prev    next >
Encoding:
Text File  |  1994-11-11  |  9.8 KB  |  483 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        Components.a
  3. ;
  4. ;    Copyright:    © 1984-1994 by Apple Computer, Inc.
  5. ;                All rights reserved.
  6. ;
  7. ;    Version:    Universal Interfaces 2.0a3  ETO #16, MPW prerelease.  Friday, November 11, 1994. 
  8. ;
  9. ;    Bugs?:        If you find a problem with this file, send the file and version
  10. ;                information (from above) and the problem description to:
  11. ;
  12. ;                    Internet:    apple.bugs@applelink.apple.com
  13. ;                    AppleLink:    APPLE.BUGS
  14. ;
  15. ;
  16.  
  17.     IF &TYPE('__COMPONENTS__') = 'UNDEFINED' THEN
  18. __COMPONENTS__ SET 1
  19.  
  20.  
  21.     IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
  22.     include 'Types.a'
  23.     ENDIF
  24. ;        include 'ConditionalMacros.a'                                ;
  25.  
  26.     IF &TYPE('__MIXEDMODE__') = 'UNDEFINED' THEN
  27.     include 'MixedMode.a'
  28.     ENDIF
  29.  
  30. kAppleManufacturer                EQU        'appl'                ; Apple supplied components 
  31. kComponentResourceType            EQU        'thng'
  32.  
  33. kAnyComponentType                EQU        0
  34. kAnyComponentSubType            EQU        0
  35. kAnyComponentManufacturer        EQU        0
  36. kAnyComponentFlagsMask            EQU        0
  37.  
  38. cmpWantsRegisterMessage            EQU        1 << 31
  39.  
  40. kComponentOpenSelect            EQU        -1                    ; ComponentInstance for this open 
  41. kComponentCloseSelect            EQU        -2                    ; ComponentInstance for this close 
  42. kComponentCanDoSelect            EQU        -3                    ; selector # being queried 
  43. kComponentVersionSelect            EQU        -4                    ; no params 
  44. kComponentRegisterSelect        EQU        -5                    ; no params 
  45. kComponentTargetSelect            EQU        -6                    ; ComponentInstance for top of call chain 
  46. kComponentUnregisterSelect        EQU        -7                    ; no params 
  47.  
  48. ; Component Resource Extension flags 
  49. componentDoAutoVersion            EQU        (1 << 0)
  50. componentWantsUnregister        EQU        (1 << 1)
  51. componentAutoVersionIncludeFlags EQU        (1 << 2)
  52. componentHasMultiplePlatforms    EQU        (1 << 3)
  53.  
  54. ; Set Default Component flags 
  55. defaultComponentIdentical        EQU        0
  56. defaultComponentAnyFlags        EQU        1
  57. defaultComponentAnyManufacturer    EQU        2
  58. defaultComponentAnySubType        EQU        4
  59. defaultComponentAnyFlagsAnyManufacturer EQU        (defaultComponentAnyFlags + defaultComponentAnyManufacturer)
  60. defaultComponentAnyFlagsAnyManufacturerAnySubType EQU        (defaultComponentAnyFlags + defaultComponentAnyManufacturer + defaultComponentAnySubType)
  61.  
  62. ; RegisterComponentResource flags 
  63. registerComponentGlobal            EQU        1
  64. registerComponentNoDuplicates    EQU        2
  65. registerComponentAfterExisting    EQU        4
  66.  
  67. ComponentDescription     RECORD    0
  68. componentType             ds.l    1                                    ; A unique 4-byte code indentifying the command set 
  69. componentSubType         ds.l    1                                    ; Particular flavor of this instance 
  70. componentManufacturer     ds.l    1                                    ; Vendor indentification 
  71. componentFlags             ds.l    1                                    ; 8 each for Component,Type,SubType,Manuf/revision 
  72. componentFlagsMask         ds.l    1                                    ; Mask for specifying which flags to consider in search, zero during registration 
  73. sizeof                     EQU    20
  74.                         ENDR
  75.  
  76. ResourceSpec             RECORD    0
  77. resType                     ds.l    1                                    ; 4-byte code  
  78. resID                     ds.w    1
  79. sizeof                     EQU    6
  80.                         ENDR
  81.  
  82. ComponentResource         RECORD    0
  83. cd                         ds        ComponentDescription                ; Registration parameters 
  84. component                 ds        ResourceSpec                        ; resource where Component code is found 
  85. componentName             ds        ResourceSpec                        ; name string resource 
  86. componentInfo             ds        ResourceSpec                        ; info string resource 
  87. componentIcon             ds        ResourceSpec                        ; icon resource 
  88. sizeof                     EQU    44
  89.                         ENDR
  90.  
  91. ComponentPlatformInfo     RECORD    0
  92. componentFlags             ds.l    1                                    ; flags of Component 
  93. component                 ds        ResourceSpec                        ; resource where Component code is found 
  94. platformType             ds.w    1                                    ; gestaltSysArchitecture result 
  95. sizeof                     EQU    12
  96.                         ENDR
  97.  
  98. ComponentResourceExtension RECORD    0
  99. componentVersion         ds.l    1                                    ; version of Component 
  100. componentRegisterFlags     ds.l    1                                    ; flags for registration 
  101. componentIconFamily         ds.w    1                                    ; resource id of Icon Family 
  102. sizeof                     EQU    10
  103.                         ENDR
  104.  
  105. ComponentPlatformInfoArray RECORD    0
  106. count                     ds.l    1
  107. platformArray             ds        ComponentPlatformInfo
  108. sizeof                     EQU    16
  109.                         ENDR
  110.  
  111. ExtComponentResource     RECORD    0
  112. cd                         ds        ComponentDescription                ; registration parameters 
  113. component                 ds        ResourceSpec                        ; resource where Component code is found 
  114. componentName             ds        ResourceSpec                        ; name string resource 
  115. componentInfo             ds        ResourceSpec                        ; info string resource 
  116. componentIcon             ds        ResourceSpec                        ; icon resource 
  117. componentVersion         ds.l    1                                    ; version of Component 
  118. componentRegisterFlags     ds.l    1                                    ; flags for registration 
  119. componentIconFamily         ds.w    1                                    ; resource id of Icon Family 
  120. count                     ds.l    1                                    ; elements in platformArray 
  121. platformArray             ds        ComponentPlatformInfo
  122. sizeof                     EQU    70
  123.                         ENDR
  124.  
  125. ComponentParameters     RECORD    0
  126. flags                     ds.b    1                                    ; call modifiers: sync/async, deferred, immed, etc 
  127. paramSize                 ds.b    1                                    ; size in bytes of actual parameters passed to this call 
  128. what                     ds.w    1                                    ; routine selector, negative for Component management calls 
  129. params                     ds.l    1                                    ; actual parameters for the indicated routine 
  130. sizeof                     EQU    8
  131.                         ENDR
  132.  
  133. ComponentRecord         RECORD    0
  134. data                     ds.l    1
  135. sizeof                     EQU    4
  136.                         ENDR
  137.  
  138. ComponentInstanceRecord RECORD    0
  139. data                     ds.l    1
  140. sizeof                     EQU    4
  141.                         ENDR
  142.  
  143. ;
  144. ;    The parameter list for each ComponentFunction is unique. It is 
  145. ;    therefore up to users to create the appropriate procInfo for their 
  146. ;    own ComponentFunctions where necessary.
  147. ;
  148.     IF GENERATING68K THEN
  149.         Macro
  150.         _RegisterComponent
  151.             moveq    #1,d0
  152.             dc.w     $A82A
  153.         EndM
  154.     ELSE
  155.         IMPORT    RegisterComponent
  156.     ENDIF
  157.  
  158.     IF GENERATING68K THEN
  159.         Macro
  160.         _RegisterComponentResource
  161.             moveq    #18,d0
  162.             dc.w     $A82A
  163.         EndM
  164.     ELSE
  165.         IMPORT    RegisterComponentResource
  166.     ENDIF
  167.  
  168.     IF GENERATING68K THEN
  169.         Macro
  170.         _UnregisterComponent
  171.             moveq    #2,d0
  172.             dc.w     $A82A
  173.         EndM
  174.     ELSE
  175.         IMPORT    UnregisterComponent
  176.     ENDIF
  177.  
  178.     IF GENERATING68K THEN
  179.         Macro
  180.         _FindNextComponent
  181.             moveq    #4,d0
  182.             dc.w     $A82A
  183.         EndM
  184.     ELSE
  185.         IMPORT    FindNextComponent
  186.     ENDIF
  187.  
  188.     IF GENERATING68K THEN
  189.         Macro
  190.         _CountComponents
  191.             moveq    #3,d0
  192.             dc.w     $A82A
  193.         EndM
  194.     ELSE
  195.         IMPORT    CountComponents
  196.     ENDIF
  197.  
  198.     IF GENERATING68K THEN
  199.         Macro
  200.         _GetComponentInfo
  201.             moveq    #5,d0
  202.             dc.w     $A82A
  203.         EndM
  204.     ELSE
  205.         IMPORT    GetComponentInfo
  206.     ENDIF
  207.  
  208.     IF GENERATING68K THEN
  209.         Macro
  210.         _GetComponentListModSeed
  211.             moveq    #6,d0
  212.             dc.w     $A82A
  213.         EndM
  214.     ELSE
  215.         IMPORT    GetComponentListModSeed
  216.     ENDIF
  217.  
  218. ; Component Instance Allocation and dispatch routines 
  219.     IF GENERATING68K THEN
  220.         Macro
  221.         _OpenComponent
  222.             moveq    #7,d0
  223.             dc.w     $A82A
  224.         EndM
  225.     ELSE
  226.         IMPORT    OpenComponent
  227.     ENDIF
  228.  
  229.     IF GENERATING68K THEN
  230.         Macro
  231.         _CloseComponent
  232.             moveq    #8,d0
  233.             dc.w     $A82A
  234.         EndM
  235.     ELSE
  236.         IMPORT    CloseComponent
  237.     ENDIF
  238.  
  239.     IF GENERATING68K THEN
  240.         Macro
  241.         _GetComponentInstanceError
  242.             moveq    #10,d0
  243.             dc.w     $A82A
  244.         EndM
  245.     ELSE
  246.         IMPORT    GetComponentInstanceError
  247.     ENDIF
  248.  
  249. ; Direct calls to the Components 
  250.     IF GENERATING68K THEN
  251.         Macro
  252.         _ComponentFunctionImplemented
  253.             dc.w     $2F3C
  254.             dc.w     $0002
  255.             dc.w     $FFFD
  256.             moveq    #0,d0
  257.             dc.w     $A82A
  258.         EndM
  259.     ELSE
  260.         IMPORT    ComponentFunctionImplemented
  261.     ENDIF
  262.  
  263.     IF GENERATING68K THEN
  264.         Macro
  265.         _GetComponentVersion
  266.             dc.w     $2F3C
  267.             dc.w     $0000
  268.             dc.w     $FFFC
  269.             moveq    #0,d0
  270.             dc.w     $A82A
  271.         EndM
  272.     ELSE
  273.         IMPORT    GetComponentVersion
  274.     ENDIF
  275.  
  276.     IF GENERATING68K THEN
  277.         Macro
  278.         _ComponentSetTarget
  279.             dc.w     $2F3C
  280.             dc.w     $0004
  281.             dc.w     $FFFA
  282.             moveq    #0,d0
  283.             dc.w     $A82A
  284.         EndM
  285.     ELSE
  286.         IMPORT    ComponentSetTarget
  287.     ENDIF
  288.  
  289. ; Component Management routines 
  290.     IF GENERATING68K THEN
  291.         Macro
  292.         _SetComponentInstanceError
  293.             moveq    #11,d0
  294.             dc.w     $A82A
  295.         EndM
  296.     ELSE
  297.         IMPORT    SetComponentInstanceError
  298.     ENDIF
  299.  
  300.     IF GENERATING68K THEN
  301.         Macro
  302.         _GetComponentRefcon
  303.             moveq    #16,d0
  304.             dc.w     $A82A
  305.         EndM
  306.     ELSE
  307.         IMPORT    GetComponentRefcon
  308.     ENDIF
  309.  
  310.     IF GENERATING68K THEN
  311.         Macro
  312.         _SetComponentRefcon
  313.             moveq    #17,d0
  314.             dc.w     $A82A
  315.         EndM
  316.     ELSE
  317.         IMPORT    SetComponentRefcon
  318.     ENDIF
  319.  
  320.     IF GENERATING68K THEN
  321.         Macro
  322.         _OpenComponentResFile
  323.             moveq    #21,d0
  324.             dc.w     $A82A
  325.         EndM
  326.     ELSE
  327.         IMPORT    OpenComponentResFile
  328.     ENDIF
  329.  
  330.     IF GENERATING68K THEN
  331.         Macro
  332.         _CloseComponentResFile
  333.             moveq    #24,d0
  334.             dc.w     $A82A
  335.         EndM
  336.     ELSE
  337.         IMPORT    CloseComponentResFile
  338.     ENDIF
  339.  
  340. ; Component Instance Management routines 
  341.     IF GENERATING68K THEN
  342.         Macro
  343.         _GetComponentInstanceStorage
  344.             moveq    #12,d0
  345.             dc.w     $A82A
  346.         EndM
  347.     ELSE
  348.         IMPORT    GetComponentInstanceStorage
  349.     ENDIF
  350.  
  351.     IF GENERATING68K THEN
  352.         Macro
  353.         _SetComponentInstanceStorage
  354.             moveq    #13,d0
  355.             dc.w     $A82A
  356.         EndM
  357.     ELSE
  358.         IMPORT    SetComponentInstanceStorage
  359.     ENDIF
  360.  
  361.     IF GENERATING68K THEN
  362.         Macro
  363.         _GetComponentInstanceA5
  364.             moveq    #14,d0
  365.             dc.w     $A82A
  366.         EndM
  367.     ELSE
  368.         IMPORT    GetComponentInstanceA5
  369.     ENDIF
  370.  
  371.     IF GENERATING68K THEN
  372.         Macro
  373.         _SetComponentInstanceA5
  374.             moveq    #15,d0
  375.             dc.w     $A82A
  376.         EndM
  377.     ELSE
  378.         IMPORT    SetComponentInstanceA5
  379.     ENDIF
  380.  
  381.     IF GENERATING68K THEN
  382.         Macro
  383.         _CountComponentInstances
  384.             moveq    #19,d0
  385.             dc.w     $A82A
  386.         EndM
  387.     ELSE
  388.         IMPORT    CountComponentInstances
  389.     ENDIF
  390.  
  391. ; Useful helper routines for convenient method dispatching 
  392.     IF GENERATING68K THEN
  393.         Macro
  394.         _CallComponentFunction
  395.             dc.w     $70FF
  396.             dc.w     $A82A
  397.         EndM
  398.     ELSE
  399.         IMPORT    CallComponentFunction
  400.     ENDIF
  401.  
  402.     IF GENERATING68K THEN
  403.         Macro
  404.         _CallComponentFunctionWithStorage
  405.             dc.w     $70FF
  406.             dc.w     $A82A
  407.         EndM
  408.     ELSE
  409.         IMPORT    CallComponentFunctionWithStorage
  410.     ENDIF
  411.  
  412.     IF GENERATING68K THEN
  413.         Macro
  414.         _DelegateComponentCall
  415.             moveq    #36,d0
  416.             dc.w     $A82A
  417.         EndM
  418.     ELSE
  419.         IMPORT    DelegateComponentCall
  420.     ENDIF
  421.  
  422.     IF GENERATING68K THEN
  423.         Macro
  424.         _SetDefaultComponent
  425.             moveq    #30,d0
  426.             dc.w     $A82A
  427.         EndM
  428.     ELSE
  429.         IMPORT    SetDefaultComponent
  430.     ENDIF
  431.  
  432.     IF GENERATING68K THEN
  433.         Macro
  434.         _OpenDefaultComponent
  435.             moveq    #33,d0
  436.             dc.w     $A82A
  437.         EndM
  438.     ELSE
  439.         IMPORT    OpenDefaultComponent
  440.     ENDIF
  441.  
  442.     IF GENERATING68K THEN
  443.         Macro
  444.         _CaptureComponent
  445.             moveq    #28,d0
  446.             dc.w     $A82A
  447.         EndM
  448.     ELSE
  449.         IMPORT    CaptureComponent
  450.     ENDIF
  451.  
  452.     IF GENERATING68K THEN
  453.         Macro
  454.         _UncaptureComponent
  455.             moveq    #29,d0
  456.             dc.w     $A82A
  457.         EndM
  458.     ELSE
  459.         IMPORT    UncaptureComponent
  460.     ENDIF
  461.  
  462.     IF GENERATING68K THEN
  463.         Macro
  464.         _RegisterComponentResourceFile
  465.             moveq    #20,d0
  466.             dc.w     $A82A
  467.         EndM
  468.     ELSE
  469.         IMPORT    RegisterComponentResourceFile
  470.     ENDIF
  471.  
  472.     IF GENERATING68K THEN
  473.         Macro
  474.         _GetComponentIconSuite
  475.             moveq    #41,d0
  476.             dc.w     $A82A
  477.         EndM
  478.     ELSE
  479.         IMPORT    GetComponentIconSuite
  480.     ENDIF
  481.  
  482.     ENDIF ; __COMPONENTS__
  483.